﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Security;
using System.Web.SessionState;
using SalaDeEnsayo.ApplicationService;

namespace SalaDeEnsayo.WebApplication
{
    public class Global : System.Web.HttpApplication
    {
        #region [VARs]

        private MembershipService membershipService;

        #endregion

        #region [Constructor]

        public Global()
        {
            this.membershipService = new MembershipService();
        }

        #endregion

        protected void Application_Start(object sender, EventArgs e)
        {

        }

        protected void Session_Start(object sender, EventArgs e)
        {

        }

        protected void Application_BeginRequest(object sender, EventArgs e)
        {

        }

        protected void Application_AuthenticateRequest(object sender, EventArgs e)
        {
            //if (HttpContext.Current.User != null && HttpContext.Current.User.Identity.IsAuthenticated)
            //{
            //    var identity = HttpContext.Current.User.Identity;
            //    var principalInfo = this.membershipService.GetPrincipalInfo(identity.Name);
            //    HttpContext.Current.User = new SalaDeEnsayoPrincipal(identity, principalInfo.UsuarioId,principalInfo.roles,principalInfo.Activo);
            //}
        }

        protected void Application_Error(object sender, EventArgs e)
        {

        }

        protected void Session_End(object sender, EventArgs e)
        {

        }

        protected void Application_End(object sender, EventArgs e)
        {

        }
    }
}